package com.ibuonline.b2b.entity;

import java.io.Serializable;

public class ArticleToColumn implements Serializable {

	private static final long serialVersionUID = -6578330400624710345L;

	//fields
	private java.lang.Integer colId;
	private java.lang.Integer artId;
	private java.lang.String title;
	private java.lang.String cover;
	private java.lang.String hot;
	private java.lang.String recommended;
	private java.lang.Integer displayOrder;

	//default constructor
	public ArticleToColumn() {
	}

	//constructor with arguments
	public ArticleToColumn(java.lang.Integer artId, java.lang.Integer colId) {
		this.artId = artId;
		this.colId = colId;
	}

	//getter
	public java.lang.Integer getColId() {
		return colId;
	}
	public java.lang.Integer getArtId() {
		return artId;
	}
	public java.lang.String getTitle() {
		return title;
	}
	public java.lang.String getCover() {
		return cover;
	}
	public java.lang.String getHot() {
		return hot;
	}
	public java.lang.String getRecommended() {
		return recommended;
	}
	public java.lang.Integer getDisplayOrder() {
		return displayOrder;
	}

	//setter
	public void setColId(java.lang.Integer colId) {
		this.colId = colId;
	}
	public void setArtId(java.lang.Integer artId) {
		this.artId = artId;
	}
	public void setTitle(java.lang.String title) {
		this.title = title;
	}
	public void setCover(java.lang.String cover) {
		this.cover = cover;
	}
	public void setHot(java.lang.String hot) {
		this.hot = hot;
	}
	public void setRecommended(java.lang.String recommended) {
		this.recommended = recommended;
	}
	public void setDisplayOrder(java.lang.Integer displayOrder) {
		this.displayOrder = displayOrder;
	}

	//equals method
	public boolean equals(Object other) {
		if (this == other)
			return true;
		if (!(other instanceof ArticleToColumn))
			return false;

		final ArticleToColumn articleToColumn = (ArticleToColumn)other;
		if (!this.artId.equals(articleToColumn.getArtId()) || 
			!this.colId.equals(articleToColumn.getColId()))
			return false;

		return true;
	}

	//hashCode method
	public int hashCode() {
		StringBuffer keys = new StringBuffer();
		keys.append(artId).append(",");
		keys.append(colId).append(",");
		if (keys.length() > 0)
			keys.deleteCharAt(keys.length() - 1);
		return keys.toString().hashCode();
	}

	//toString method
	public String toString() {
		return new StringBuilder("ArticleToColumn[")
			.append("colId=").append(colId).append(", ")
			.append("artId=").append(artId).append(", ")
			.append("title=").append(title).append(", ")
			.append("cover=").append(cover).append(", ")
			.append("hot=").append(hot).append(", ")
			.append("recommended=").append(recommended).append(", ")
			.append("displayOrder=").append(displayOrder).append("]").toString();
	}
	
	///##############
	
	 public String getCoverPath() {
	        if (cover == null) {
	            return null;
	        }
	        return com.ibuonline.b2b.common.ResourceUtil.getResPath(cover);
	    }
}